package org.rambadger.command.event;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.rambadger.command.validation.UrlIdentifier;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * Event representing the creation of a {@link org.rambadger.command.model.PlatformAggregate Platform}.
 */
public class PlatformCreated implements Serializable {
    private static final long serialVersionUID = 1153208481729400497L;

    private final String platformId;
    private final String platformName;
    private final String description;

    /**
     * Instantiates a new event
     *
     * @param platformId the unique identifier for the platform
     * @param platformName the platform name/title
     * @param description the description
     */
    public PlatformCreated(String platformId, String platformName, String description) {
        this.platformId = platformId;
        this.platformName = platformName;
        this.description = description;
    }

    /**
     * Gets unique identifier for the platform that was created.
     *
     * @return the platform id
     */
    @UrlIdentifier @NotNull
    public String getPlatformId() {
        return platformId;
    }

    /**
     * Gets platform name/title.
     *
     * @return the platform name
     */
    @Length(max = 64) @NotBlank
    public String getPlatformName() {
        return platformName;
    }

    /**
     * Gets description.
     *
     * @return the description
     */
    @Length(max = 4096) @NotNull
    public String getDescription() {
        return description;
    }

    @Override
    public String toString() {
        return "PlatformCreated{" +
                "platformId='" + platformId + '\'' +
                ", platformName='" + platformName + '\'' +
                ", description='" + description + '\'' +
                '}';
    }
}